package loadvideo;

import android.app.IntentService;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.example.administrator.weipiao.HttpUtil;

import java.io.IOException;


public class DownloadService extends IntentService {

    private String  path="http://flv.bn.netease.com/videolib3/1607/19/dAHwJ2288/HD/dAHwJ2288-mobile.mp4";




    public DownloadService() {
        super("");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        try {
            byte[] bytes = HttpUtil.loadData(path);
            Log.i("tag",SDUtil.getSDPath());
            boolean isSave = SDUtil.saveData("aaa.mp4", bytes);
            if (isSave) {
                Log.i("tag","");
                Intent intent1=new Intent("receiver");
                intent1.putExtra("key","aaa.mp4");
                sendBroadcast(intent1);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
